import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    meta: {
      title: '萌宠之家',
      show: false,
      headr: true
    }
  },
  {
    path: '/publish',
    name: 'Publish',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/Publish/Publish.vue'),
    meta: {
      title: '萌宠之家',
      show: false,
      headr: true
    }

  },
  {
    path: '/adoption',
    name: 'Adoption',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/Adoption/Adoption.vue'),
    meta: {
      title: '领养中心',
      show: false,
      headr: true,
      active:true
    }
  },
  {
    path: '/news',
    name: 'News',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/News/News.vue'),
    meta: {
      title: '消息中心',
      show: false,
      headr: true
    }
  },
  {
    path: '/my',
    name: 'My',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/My/My.vue'),
    meta: {
      title: '个人中心',
      headr: true
    }
  },
  {
    path: '/neutralize',
    name: 'neutralize',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../components/LoginAndRegistration/neutralize/neutralize.vue'),
    meta: {
      show: true,
    }
  },
  {
    path: '/forAdoption',
    name: 'ForAdoption',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../components/Publish/ForAdoption/ForAdoption.vue'),
    meta: {
      title: '发布送养信息',
      show: true,
      headr: true
    }
  },
  {
    path: '/forAdoption2',
    name: 'ForAdoption2',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../components/Publish/ForAdoption2/ForAdoption2.vue'),
    meta: {
      title: '发布送养信息',
      show: true,
      headr: true
    }
  },
  {
    path: '/details',
    name: 'details',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../components/adoption/details/details.vue'),
    meta: {
      title: '领养中心',
      show: true,
      headr: true
    }
  },
  {
    path: '/personaldata',
    name: 'personaldata',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../components/My/personaldata/personaldata.vue'),
    meta: {
      title: '个人资料',
      show: true,
      headr: true,
      myShow: true
    }
  },
  {
    path: '/adoptionApplication',
    name: 'adoptionApplication',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../components/My/adoptionApplication/adoptionApplication.vue'),
    meta: {
      title: '领养申请',
      show: true,
      headr: true,
      myShow: true
    }
  },
  {
    path: '/blacklist',
    name: 'blacklist',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../components/My/blacklist/blacklist.vue'),
    meta: {
      title: '我的送养',
      show: true,
      headr: true,
      myShow: true
    }
  },
  {
    path: '/MyAdoption',
    name: 'MyAdoption',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../components/My/MyAdoption/MyAdoption.vue'),
    meta: {
      title: '我的领养',
      show: true,
      headr: true
    }
  },
  {
    path: '/MyCollection',
    name: 'MyCollection',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../components/My/MyCollection/MyCollection.vue'),
    meta: {
      title: '收藏',
      show: true,
      headr: true
    }
  },
  {
    path: '/MyFosterCare',
    name: 'MyFosterCare',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../components/My/MyFosterCare/MyFosterCare.vue'),
    meta: {
      title: '我的黑名单',
      show: true,
      headr: true
    }
  },
  {
    path: '/messageCenter',
    name: 'messageCenter',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../components/newss/messageCenter/messageCenter.vue'),
    meta: {
      title: '官方通知',
      show: true,
      headr: true
    }
  },
  {
    path: '/help',
    name: 'help',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../components/home/Help/Help.vue'),
    meta: {
      title: '帮助中心',
      show: true,
      headr: true
    }
  },
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})
router.beforeEach((to, from, next) => {
  window.scrollTo(0, 0)  
  next()
})

export default router
